/**
 * 
 */
package com.icygen.eclipsetools.ui.wizards;

import java.util.ArrayList;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.tigris.subversion.svnclientadapter.SVNClientException;

import com.icygen.core.svn.Repository;
import com.icygen.eclipsetools.project.IcygenThemesSupport;

/**
 * @author vanko
 *
 */
public class ProjectLibrariesPage extends WizardPage
{
	private Composite container;
	
	private ArrayList<Button> checkboxLibraries;
	
	public ProjectLibrariesPage() 
	{
	    super("Project Libraries");
	    setTitle("Project Libraries");
	    setDescription("VS Tools Create Project Wizard Libraries Page.");
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	public void createControl(Composite parent)
	{
		System.out.println("BEGIN createControl");
		
		container = new Composite(parent, SWT.NONE);
	    GridLayout layout = new GridLayout();
	    container.setLayout(layout);
	    layout.numColumns = 2;
	    
	    checkboxLibraries = new ArrayList<Button>();
	    for(String library : Repository.Libraries.keySet()) {
	    	Button btnLibrary = new Button(container, SWT.CHECK);
	    	btnLibrary.setText(library);
		    
	    	//if(IcygenThemesSupport.coreThemes.contains(theme)) {
	    	if(true) {
	    		btnLibrary.setEnabled(false);
	    		btnLibrary.setSelection(true);
	    	}
	    	
		    setControl(btnLibrary);
		    checkboxLibraries.add(btnLibrary);
	    }
	    
	    // Required to avoid an error in the system
	    setControl(container);
	    setPageComplete(true);
	}
	
	public ArrayList<Button> getCheckboxLibraries()
	{
		return this.checkboxLibraries;
	}
	
}
